<template>
  <div class="container">
    <el-dialog
      title="题目审核"
      :visible="isDialog"
      width="30%"
      @close="cldialog"
      @open="opendialog"
    >
      <el-form ref="shform" label-width="80px" :model="shform">
        <el-form-item>
          <el-radio-group v-model="shform.chkState">
            <el-radio :label="1">通过</el-radio>
            <el-radio :label="2">拒绝</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item>
          <el-input v-model="shform.chkRemarks" type="textarea" placeholder="请输入审核意见" />
        </el-form-item>
      </el-form>

      <span slot="footer" class="dialog-footer">
        <el-button @click="cldialog">取 消</el-button>
        <el-button type="primary" @click="login">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import { choiceCheck } from '@/api/hmmm/questions.js'
export default {
  name: 'CheckQuee',
  props: {
    isDialog: {
      type: Boolean
    },
    auditId: {
      type: Number,
      default: 1
    }
  },
  data () {
    return {
      shform: {
        chkState: 1,
        chkRemarks: '',
        id: undefined
      }

    }
  },
  methods: {
    cldialog () {
      this.$emit('clshdia')
      this.shform = {
        chkState: 1,
        chkRemarks: '',
        id: undefined
      }
    },
    opendialog () {
      // console.log(this.auditId)
      this.shform.id = this.auditId
    },
    async login () {
      if (this.shform.chkRemarks.trim() === '') {
        this.$message.warning('请输入审核意见')
        return
      }
      await choiceCheck(this.shform)
      this.$message.success('操作成功')
      this.shform = {
        chkState: 1,
        chkRemarks: '',
        id: undefined
      }
      this.$emit('closeadd')
      this.cldialog()
      // this.closeAuditDialogFormVisible()
      // this.auditForm = res.data
    }
  }

}
</script>

<style scoped lang='less'></style>
